import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Game {
    private final String[] suit = {"♦", "♣", "♠", "♥"};

    public List<Poker> buyPoker(){
        List<Poker> pokers = new ArrayList<>();
        for (int i = 0; i < 4; i++){
            for (int j = 1; j <= 13; j++){
                Poker poker = new Poker(suit[i], j);
                pokers.add(poker);
            }
        }
        return pokers;
    }

    public void washPoker(List<Poker> poker) {
        Random random = new Random();
        for (int i = poker.size() - 1; i > 0; i--) {
            int index = random.nextInt(i);
            swap(poker, i, index);
        }
    }

    public void swap(List<Poker> poker, int i, int index){
        Poker tmp = poker.get(i);
        poker.set(i, poker.get(index));
        poker.set(index, tmp);
    }

    //抽牌规则：一人抽一张，一共抽五轮
    public List<List<Poker>> getPoker(List<Poker> pokers){
        List<List<Poker>> hand = new ArrayList<>();
        List<Poker> hand1 = new ArrayList<>();
        List<Poker> hand2 = new ArrayList<>();
        List<Poker> hand3 = new ArrayList<>();
        hand.add(hand1);
        hand.add(hand2);
        hand.add(hand3);
        for (int i = 1; i <= 5; i++){
            for (int j = 0; j < 3; j++){
                Poker ret = pokers.remove(0);
                hand.get(j).add(ret);
            }
        }
        return hand;
    }
}













